package com.gxa.service.impl;

import com.github.pagehelper.PageHelper;
import com.gxa.pojo.CarBill;
import com.gxa.dao.CarBillMapper;
import com.gxa.service.CarBillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CarBillServiceImpl implements CarBillService {

    @Autowired
    private CarBillMapper carBillMapper;

    @Override
    public boolean addCarBill(CarBill carBill) {
        return carBillMapper.insertCarBill(carBill)>0;
    }

    @Override
    public List<CarBill> selectAllCarBillByPage(int pageNum,int pageSize) {

        PageHelper.startPage(pageNum, pageSize);

        List<CarBill> carBills = carBillMapper.selectAllCarBill();

        return carBills;

//        return carBillMapper.selectAllCarBill();
    }

    @Override
    public boolean deleteCarBillByCarOwner(String carOwner) {
        return carBillMapper.deleteCarBillByCarOwner(carOwner)>0;
    }

    @Override
    public boolean batchDeleteCarBill(String[] carOwners) {
        return carBillMapper.batchDeleteCarBill(carOwners)>0;
    }
}
